package com.lry.sso.auth.common.util;

import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * 用户信息
 *
 * @author wrp
 * @since 2018/6/21
 */
@Data
public class SessionInfo {

    private Long userId;
    private String userName;
    private String account;
    private boolean isAdmin;
    private String url;

    private String groupName;

    private String sessionId;

    /**
     * 工组ID列表，与该用户直接关联的工组
     */
    private List<Integer> groupIdList = Collections.emptyList();
    /**
     * 获取直接关联工组的子工组，即与该用户间接关联的工组
     */
    private List<Integer> subGroupIdList = Collections.emptyList();
    /**
     * 
     * 角色ID列表
     */
    private List<Integer> roleIdList = Collections.emptyList();

    /**
     * 权限id列表
     */
    private List<Integer> permissionIdList = Collections.emptyList();

    /**
     * token签发时间
     */
    private Long iat;

    public SessionInfo() {}

    public SessionInfo(Long userId, String userName) {
        super();
        this.userId = userId;
        this.userName = userName;
    }

    public void setIsAdmin(Boolean isAdmin) {
        this.isAdmin = isAdmin;
    }

    public Boolean getIsAdmin() {
        return this.isAdmin;
    }

    @Override public String toString() {
        return "SessionInfo{" +
            "userId=" + userId +
            ", userName='" + userName + '\'' +
            ", account='" + account + '\'' +
            ", isAdmin=" + isAdmin +
            ", roleIdList=" + roleIdList +
            ", permissionIdList=" + permissionIdList +
            ", iat=" + iat +
            '}';
    }
}
